var common = require('../../../utils/common.js');
var app=getApp();
var baseUrl=app.url;

Page({
    data: {
        __PUBLIC__:app.__PUBLIC__,
        display:true,
        carList:[{"id":{"user_name":12345678901,"nick_name":'周某人','agency':'广州加盟商'},"small":[{"user_name":78945612301,"nick_name":'周某人'},{"user_name":78945612301,"nick_name":'许某人'},{"user_name":78945612301,"nick_name":'卢某人'}]},{"id":{"user_name":12345678930,"nick_name":'刘某人','agency':'湛江加盟商'},"small":[{"user_name":12345678920,"nick_name":'张某人'},{"user_name":12345678920,"nick_name":'卢某人'},{"user_name":78945612301,"nick_name":'陈某人'}]},{"id":{"user_name":12345678901,"nick_name":'卢某人','agency':'贵阳加盟商'},"small":[{"user_name":78945612301,"nick_name":'欧某人'},{"user_name":78945612301,"nick_name":'周某人'},{"user_name":78945612301,"nick_name":'周某人'}]}],
    },
    onLoad:function(options){
        // common.bestCurl('GET','/admin/index',res=>{
        //     if(res.statusCode == 200){
        //         console.log(res.data)
        //     }
        // })
    },
    superAdmin: function (e) {
        var agency_id = e.currentTarget.id;
        carList = this.data.carList;
        for(var index in carList){
            var id = carList[index].id.agency;
            if(agency_id == id){
                carList[index].id.open = !carList[index].id.open;
            }else{
                carList[index].id.open = false;
            }
        }
        this.setData({carList:carList})
    },
    add:function(){
        this.setData({display:false})
    },
    cancel:function(){
        var that = this;
        setTimeout(function(){

            that.setData({display:true})
        },700)

    },
    clickRole:function(){
        wx.navigateTo({
            url: '../add/add'
        })
        this.setData({display:true})
    },
    clickMember:function () {
       wx.navigateTo({
            url: '../add/add'
        })
       this.setData({display:true})
    },
    
})
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      